package model

type Account struct {
	Symbol            string  `json:"symbol"`
	MarginBalance     float64 `json:"margin_balance"`
	MarginPosition    float64 `json:"margin_position"`
	MarginFrozen      float64 `json:"margin_frozen"`
	MarginAvailable   float64 `json:"margin_available"`
	ProfitReal        float64 `json:"profit_real"`
	ProfitUnreal      float64 `json:"profit_unreal"`
	RiskRate          float64 `json:"risk_rate"`
	LiquidationPrice  float64 `json:"liquidation_price"`
	WithdrawAvailable float64 `json:"withdraw_available"`
	LeverRate         float64 `json:"lever_rate"`
	AdjustFactor      float64 `json:"adjust_factor"`
	MarginStatic      float64 `json:"margin_static"`
}

type Index struct {
	Symbol     string  `json:"symbol"`
	IndexPrice float64 `json:"index_price"`
	IndexTS    int64   `json:"index_ts"`
}

type PositionRatio struct {
	BuyRatio   float64 `json:"buy_ratio"`  //多仓占比
	SellRatio  float64 `json:"sell_ratio"` //空仓占比
	IndexPrice float64 `json:"index_price"`
	TS         int64   `json:"ts"`
}
type RatioResult struct {
	Status string `json:"status"`
	Data   struct {
		Symbol string          `json:"symbol"`
		List   []PositionRatio `json:"list"`
	} `json:"data"`
	TS int64 `json:"ts"`
}

func (this *RatioResult) GetLatestSuggest() string {
	last := this.Data.List[len(this.Data.List)-1:][0]
	if last.BuyRatio > last.SellRatio {
		return "buy"
	}
	return "sell"
}
